<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<sj:head jqueryui="true" jquerytheme="redmond"></sj:head>
<script type="text/javascript">
	function onClickCopy() {
		window.location = "serviceCopyAction.action";
	}

	function onClickCreate() {
		window.location = "serviceCreateAction.action";
	}
	function filterList(){
		window.location = "ServiceListAction.action";
	}

	$.subscribe('rowselect', function(event, data) {
		var grid = event.originalEvent.grid;
		var sel_id = grid.jqGrid('getGridParam', 'selrow');
		var isActive = grid.jqGrid('getCell', sel_id, 'isActive');
		if (isActive == "No") {
			var answer = confirm("Do you want to make this Service active?");
			if (answer) {

			} else {

			}
		}

	});
</script>
</head>
<body>
	<h3>Service List</h3>
	<s:form theme="simple">
		<tr>
			<s:select name="filter" onchange="filterList()"
				list="#{'0':'0-9','A':'A B C D E','F':'F G H I J','K':'K L M N','O':'O P Q R','S':'S T U V','W':'W X Y Z'}"
				headerKey="" headerValue="All">

			</s:select>
			<td><sj:a button="true" onclick="onClickCopy()">Copy</sj:a></td>
			<td><sj:a button="true" onclick="onClickCreate()">Create</sj:a>
			</td>
			<td><s:checkbox name="getAll" onclick="filterList()"> Include In-active </s:checkbox></td>
		</tr>
		<br>
		<s:url id="getServicesUrl" action="ServiceListAction" />
		<sjg:grid id="gridtable" caption="Customer Examples" dataType="json"
			href="%{getServicesUrl}" pager="true" gridModel="gridModel"
			rowNum="15" rownumbers="true" onSelectRowTopics="rowselect">
			<sjg:gridColumn name="serviceName" index="serviceName"
				title="Service Name" sortable="false" />
			<sjg:gridColumn name="ShortDescription" index="ShortDescription"
				title="Description" sortable="false" />
			<sjg:gridColumn name="ServiceType" index="ServiceType"
				title="Service Type" sortable="false" />
			<sjg:gridColumn name="LeadContact" index="LeadContact"
				title="Contact" sortable="false" />
		</sjg:grid>
	</s:form>
</body>
</html>